############################################################################
#
# makefile template for the L3IF Projet Programmation class
#
############################################################################

CC = gcc

CFLAGS = -g -Wall -ansi -pedantic

LIBS = -lm -lSDLmain -lSDL `sdl-config --cflags --libs`

SRCS = src/noeud.c src/arete.c src/graphe.c src/affichage.c
SRCM = src/main.c
SRCT = src/test.c

OBJS = $(SRCS:.c=.o)
OBJM = $(SRCM:.c=.o)
OBJT = $(SRCT:.c=.o)

MAIN = mymain

TEST = test/test

all:	$(MAIN)

run:
	make all
	./$(MAIN)

$(MAIN): $(OBJS) $(OBJM)
	$(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(OBJM) $(LIBS)

.c.o:
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(LIBS)

test: $(OBJS) $(OBJT)
	$(CC) $(CFLAGS) $(INCLUDES) -o $(TEST) $(OBJS) $(OBJT) $(LIBS)
	./$(TEST)

clean:
	rm src/*.o src/*~ $(TEST) $(MAIN)
